package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

public class ResponseRedisDataMessage extends AbstractStruct {
    private byte[] result = new byte[4];
    private byte[] strresult = new byte[512];

    private static int LENGTH = 4+512;

    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(result);
        bf.put(strresult);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(result);
        bf.get(strresult);
    }

    public String getResult() {
        return ByteTransfer.getString(result);
    }

    public void setResult(String result) {
        ByteTransfer.str2Byte(result, this.result);
    }

    public String getStrresult() {
        return ByteTransfer.getString(strresult);
    }

    public void setStrresult(String strresult) {
        ByteTransfer.str2Byte(strresult, this.strresult);
    }


    @Override
    public int getLength() {
        return LENGTH;
    }

}
